package com.qf.business.student.input;

import com.qf.business.student.valid.MyValid;
import com.qf.commons.web.valid.CustemValid;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
 * description: 学生实体的入参对象
 * author: Ken
 * 公众号：Java架构栈
 */
@Data
@CustemValid(message = "生日和年龄并不匹配！", handler = MyValid.class)
public class StudentInput implements Serializable {

    @NotBlank(message = "学生姓名不能为空！")
    private String name;
    @Min(value = 10, message = "年龄不能低于10岁")
    @Max(value = 20, message = "年龄不能超过20岁")
    @NotNull(message = "年龄不能为空！")
    private Integer age;
    @Email(message = "邮箱格式不正确！")
    @NotBlank(message = "邮箱不能为空！")
    private String email;
    @NotNull(message = "生日不能为空！")
    @Past(message = "生日的范围不正确！")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    @NotNull(message = "性能不能为空！")
    private String sex;
    @NotNull(message = "班级信息不能为空！")
    private Long cid;
}
